#ifndef __MYSTRING_H_
#define __MYSTRING_H_

#include "MyString.h"
#include <stdbool.h>
#define INITSTR(s) MyStr s;InitString(&s);
#define INSERTSTR(s,str) INITSTR(s);InsertString(&s,str);

struct StdMyString
{
    char *string;
    int size;//申请的堆上空间
    int len;//实际的字符串长度
};

typedef struct StdMyString MyStr;


//结构体的前置声明
struct StdStringList;
typedef struct StdStringList MyStrList;

void InitString(MyStr *s);
bool InsertString(MyStr * s,const char * str);
bool InsertByIndex(MyStr * s,const char * str,int index);
bool InsertChar(MyStr *s,char c,int index);
//删除字符串(主字符串删子字符串)
bool RemoveString(MyStr *s,const char *str);
bool IsContains(MyStr *s,const char *str);
bool IsEqual(MyStr *s,const char *str); 
//不区分大小写
bool IsEqualCaseInsensitive(MyStr *s,const char *str);
//全变大写
MyStr ToUpper(const char *str);
//全变小写
MyStr ToLower(const char *str);
int StringToInt(MyStr *s);
double StringToDouble(MyStr * s);
MyStr CopyString(const MyStr *s);
MyStr GetString(const char *s);
//字符串切割
MyStrList Split(const char *src, const char *demil);
void ClearString(MyStr *s);



struct StdStringList
{
    MyStr *StringList;
    int len;//长度
    int size;//容量
};


void InitMyStringList(MyStrList *list);
bool InsertTail(MyStrList *list,const char *str);
//按位置删除字符串
bool RemoveMyStrByIndex(MyStrList *list,int index);
//删除字符串(字符串数组中删除元素)
bool RemoveMySting(MyStrList *list,const char *str);
//遍历字符串
void DisplayStringList(MyStrList *list);
void ClearMyStringList(MyStrList *list);

#endif